package ex3;
import java.util.Scanner;

public class Test1 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Person[] persons = new Person[n];
		for (int i = 0; i < n; i++) {
			persons[i] = new Person(scanner.next(), scanner.nextInt(), scanner.nextBoolean());
		}
		for (int i = n - 1; i >= 0; i--) {
			System.out.println(persons[i]);
		}
		System.out.println(new Person().toString());
		scanner.close();
	}
}